home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / right_co.swf / scripts / DefineSprite_241 / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-23  |  1.8 KB  |  70 lines

  1. function init()
  2. {
  3.    if(this.objNum == 1)
  4.    {
  5.       this._x = _parent.obj5_mc._x - _parent.obj_space;
  6.    }
  7.    if(this.objNum == 2)
  8.    {
  9.       this._x = _parent.obj1_mc._x - _parent.obj_space;
  10.    }
  11.    if(this.objNum == 3)
  12.    {
  13.       this._x = _parent.obj2_mc._x - _parent.obj_space;
  14.    }
  15.    if(this.objNum == 4)
  16.    {
  17.       this._x = _parent.obj3_mc._x - _parent.obj_space;
  18.    }
  19.    if(this.objNum == 5)
  20.    {
  21.       this._x = _parent.obj4_mc._x - _parent.obj_space;
  22.    }
  23.    gof = Math.floor(Math.random() * 4) + 1;
  24.    this.gotoAndStop(gof);
  25.    idx = Math.floor(Math.random() * 5) + 1;
  26.    _parent["obj" + i + "_mc"]._y = _parent["backY" + idx];
  27. }
  28. if(this.onEnterFrame == undefined)
  29. {
  30.    ani_num = -1;
  31.    this.onEnterFrame = function()
  32.    {
  33.       if(_parent.game_start == true)
  34.       {
  35.          if(this._x >= _parent.obj_endX)
  36.          {
  37.             if(_parent.target_mc["target" + _parent.now_target + "_mc"].objType == this._currentframe and this._y == _parent.backY3 and _parent.target_mc.gor == 0)
  38.             {
  39.                _parent.target_mc["target" + _parent.now_target + "_mc"].gotoAndStop(3);
  40.                init();
  41.             }
  42.             else if(this._currentframe <= 4)
  43.             {
  44.                gof = this._currentframe + 4;
  45.                this.gotoAndStop(gof);
  46.             }
  47.          }
  48.          else if(_parent.dontMove == false)
  49.          {
  50.             this._x += _parent.obj_speed;
  51.          }
  52.       }
  53.       ani_num++;
  54.       if(ani_num == 0 or ani_num == 6 or ani_num == 12 or ani_num == 18)
  55.       {
  56.          this._xscale -= 3;
  57.          this._yscale += 3;
  58.       }
  59.       if(ani_num == 3 or ani_num == 9 or ani_num == 15 or ani_num == 20)
  60.       {
  61.          this._xscale += 3;
  62.          this._yscale -= 3;
  63.       }
  64.       if(ani_num >= 20)
  65.       {
  66.          ani_num = -1;
  67.       }
  68.    };
  69. }
  70.